%% Produce content of Table 2

%% Okun

load('output\results_Table2_okun')

cycle_uncertainty_okun = cycle_uncertainty;
trend_uncertainty_okun = trend_uncertainty;

trend_percentiles_okun = trend_percentiles;

mean_1947_1972_okun = mean(trend_percentiles_okun(1:312,3));
mean_1973_1995_okun = mean(trend_percentiles_okun(313:588,3));
mean_1995_2007_okun = mean(trend_percentiles_okun(589:732,3));
mean_2008_2015_okun = mean(trend_percentiles_okun(733:end,3));
mean_2015_okun = mean(trend_percentiles_okun(end:end,3));

%% Mariano murasawa

load('output\results_Table2_mm')

cycle_uncertainty_MM03 = cycle_uncertainty;
trend_uncertainty_MM03 = trend_uncertainty;

trend_percentiles_MM03 = trend_percentiles;

mean_1947_1972_MM03 = mean(trend_percentiles_MM03(1:312,3));
mean_1973_1995_MM03 = mean(trend_percentiles_MM03(313:588,3));
mean_1995_2007_MM03 = mean(trend_percentiles_MM03(589:732,3));
mean_2008_2015_MM03 = mean(trend_percentiles_MM03(733:end,3));
mean_2015_MM03 = mean(trend_percentiles_MM03(end:end,3));

%% ADP No Consumption

load('output\results_Table2_basenoC')

cycle_uncertainty_ADPnoConsumption = cycle_uncertainty;
trend_uncertainty_ADPnoConsumption = trend_uncertainty;

trend_percentiles_ADPnoConsumption = trend_percentiles;

mean_1947_1972_ADPnoConsumption = mean(trend_percentiles_ADPnoConsumption(1:312,3));
mean_1973_1995_ADPnoConsumption = mean(trend_percentiles_ADPnoConsumption(313:588,3));
mean_1995_2007_ADPnoConsumption = mean(trend_percentiles_ADPnoConsumption(589:732,3));
mean_2008_2015_ADPnoConsumption = mean(trend_percentiles_ADPnoConsumption(733:end,3));
mean_2015_ADPnoConsumption = mean(trend_percentiles_ADPnoConsumption(end:end,3));

%% Baseline ADP

load('output\results_Table2_base')

cycle_uncertainty_Baseline = cycle_uncertainty;
trend_uncertainty_Baseline = trend_uncertainty;

trend_percentiles_Baseline = trend_percentiles;

mean_1947_1972_Baseline = mean(trend_percentiles_Baseline(1:312,3));
mean_1973_1995_Baseline = mean(trend_percentiles_Baseline(313:588,3));
mean_1995_2007_Baseline = mean(trend_percentiles_Baseline(589:732,3));
mean_2008_2015_Baseline = mean(trend_percentiles_Baseline(733:end,3));
mean_2015_Baseline = mean(trend_percentiles_Baseline(end:end,3));

%% Extended ADP No Consumption

load('output\results_Table2_extnoC')

cycle_uncertainty_extended_no_C = cycle_uncertainty;
trend_uncertainty_extended_no_C = trend_uncertainty;

trend_percentiles_extended_no_C = trend_percentiles;

mean_1947_1972_extended_no_C = mean(trend_percentiles_extended_no_C(1:312,3));
mean_1973_1995_extended_no_C = mean(trend_percentiles_extended_no_C(313:588,3));
mean_1995_2007_extended_no_C = mean(trend_percentiles_extended_no_C(589:732,3));
mean_2008_2015_extended_no_C = mean(trend_percentiles_extended_no_C(733:end,3));
mean_2015_extended_no_C = mean(trend_percentiles_extended_no_C(end:end,3));


%% Extended ADP

load('output\results_Table2_ext')

cycle_uncertainty_extended = cycle_uncertainty;
trend_uncertainty_extended = trend_uncertainty;

trend_percentiles_extended = trend_percentiles;

mean_1947_1972_extended = mean(trend_percentiles_extended(1:312,3));
mean_1973_1995_extended = mean(trend_percentiles_extended(313:588,3));
mean_1995_2007_extended = mean(trend_percentiles_extended(589:732,3));
mean_2008_2015_extended = mean(trend_percentiles_extended(733:end,3));
mean_2015_extended = mean(trend_percentiles_extended(end:end,3));

%% Table

cycle_filtered_uncertainty_total = [cycle_uncertainty_okun(:,1) cycle_uncertainty_MM03(:,1) cycle_uncertainty_ADPnoConsumption(:,1) cycle_uncertainty_Baseline(:,1) cycle_uncertainty_extended_no_C(:,1) cycle_uncertainty_extended(:,1)];
cycle_filtered_uncertainty_filtering = [cycle_uncertainty_okun(:,2) cycle_uncertainty_MM03(:,2) cycle_uncertainty_ADPnoConsumption(:,2) cycle_uncertainty_Baseline(:,2) cycle_uncertainty_extended_no_C(:,2) cycle_uncertainty_extended(:,2)];
cycle_filtered_uncertainty_parameter = cycle_filtered_uncertainty_total - cycle_filtered_uncertainty_filtering;

cycle_smoothed_uncertainty_total = [cycle_uncertainty_okun(:,3) cycle_uncertainty_MM03(:,3) cycle_uncertainty_ADPnoConsumption(:,3) cycle_uncertainty_Baseline(:,3) cycle_uncertainty_extended_no_C(:,3) cycle_uncertainty_extended(:,3)];
cycle_smoothed_uncertainty_filtering = [cycle_uncertainty_okun(:,4) cycle_uncertainty_MM03(:,4) cycle_uncertainty_ADPnoConsumption(:,4) cycle_uncertainty_Baseline(:,4) cycle_uncertainty_extended_no_C(:,4) cycle_uncertainty_extended(:,4)];
cycle_smoothed_uncertainty_parameter = cycle_smoothed_uncertainty_total - cycle_smoothed_uncertainty_filtering;

trend_filtered_uncertainty_total = [trend_uncertainty_okun(:,1) trend_uncertainty_MM03(:,1) trend_uncertainty_ADPnoConsumption(:,1) trend_uncertainty_Baseline(:,1) trend_uncertainty_extended_no_C(:,1) trend_uncertainty_extended(:,1)];
trend_filtered_uncertainty_filtering = [trend_uncertainty_okun(:,2) trend_uncertainty_MM03(:,2) trend_uncertainty_ADPnoConsumption(:,2) trend_uncertainty_Baseline(:,2) trend_uncertainty_extended_no_C(:,2) trend_uncertainty_extended(:,2)];
trend_filtered_uncertainty_parameter = trend_filtered_uncertainty_total - trend_filtered_uncertainty_filtering;

trend_smoothed_uncertainty_total = [trend_uncertainty_okun(:,3) trend_uncertainty_MM03(:,3) trend_uncertainty_ADPnoConsumption(:,3) trend_uncertainty_Baseline(:,3) trend_uncertainty_extended_no_C(:,3) trend_uncertainty_extended(:,3)];
trend_smoothed_uncertainty_filtering = [trend_uncertainty_okun(:,4) trend_uncertainty_MM03(:,4) trend_uncertainty_ADPnoConsumption(:,4) trend_uncertainty_Baseline(:,4) trend_uncertainty_extended_no_C(:,4) trend_uncertainty_extended(:,4)];
trend_smoothed_uncertainty_parameter = trend_smoothed_uncertainty_total - trend_smoothed_uncertainty_filtering;

% Upper panel of table 2
disp(round([ mean_1947_1972_okun mean_1947_1972_MM03 mean_1947_1972_ADPnoConsumption mean_1947_1972_Baseline mean_1947_1972_extended_no_C mean_1947_1972_extended;
       mean_1973_1995_okun mean_1973_1995_MM03 mean_1973_1995_ADPnoConsumption mean_1973_1995_Baseline mean_1973_1995_extended_no_C mean_1973_1995_extended;
       mean_1995_2007_okun mean_1995_2007_MM03 mean_1995_2007_ADPnoConsumption mean_1995_2007_Baseline mean_1995_2007_extended_no_C mean_1995_2007_extended;
       mean_2008_2015_okun mean_2008_2015_MM03 mean_2008_2015_ADPnoConsumption mean_2008_2015_Baseline mean_2008_2015_extended_no_C mean_2008_2015_extended;
       mean_2015_okun mean_2015_MM03 mean_2015_ADPnoConsumption mean_2015_Baseline mean_2015_extended_no_C mean_2015_extended;],1));

% Lower panel of table 2
disp(round([mean(trend_filtered_uncertainty_total,1); mean(trend_smoothed_uncertainty_total,1);  ...
      mean(cycle_filtered_uncertainty_total,1); mean(cycle_smoothed_uncertainty_total,1);],2));

% Parameter uncertainty separately
% disp([mean(cycle_filtered_uncertainty_total,1); mean(cycle_filtered_uncertainty_parameter,1); mean(cycle_smoothed_uncertainty_total,1); mean(cycle_smoothed_uncertainty_parameter,1); ...
%       mean(trend_filtered_uncertainty_total,1); mean(trend_filtered_uncertainty_parameter,1); mean(trend_smoothed_uncertainty_total,1); mean(trend_smoothed_uncertainty_parameter,1)]);
 
  